<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>数组的队列案例</title>
  <style>
    #demo {
      font-size: 30px;
    }
  </style>
</head>
<body>
  <p id="demo">—<—<—<—<—<—<—<—<—<—<—<—<</p>
  <script>
    var dome = document.getElementById("demo")
    var fun = function () {
      var str = dome.innerText;
      var arr = str.split('');
      
      arr.push(arr.shift());
      demo.innerText = arr.join('');
    }
    var timer = setInterval(() => {
      fun()
    }, 500)
  </script>
</body>
</html>